package com.dc.modules.sys.user.domain;

import java.io.Serializable;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.dc.commons.persistence.UseEntity;
import com.dc.commons.persistence.embeddable.Dict;
import com.dc.commons.sys.persistence.User;
import com.dc.commons.utils.excel.ImportFormat;
import com.dc.commons.utils.excel.RowData;

/*******************************************************************************<P>
 * 文件名: User.java <br>
 * 版本: 1.0<br>
 * 描述:<br>
 * 版权所有: <br>
 * <P>
 * 创建者: 王建栋 <br>
 * 创建日期: 2016年4月7日 下午2:44:10<br>
 * 修改者: <br>
 * 修改日期: <br>
 * 修改说明: <br>
 ******************************************************************************/
@Entity
@Table(name="DC_SYS_USER")
public class DcSysUser extends UseEntity implements User,Serializable,ImportFormat<DcSysUser>{
	private static final long serialVersionUID = 1L;
	
	private String userCode;
	private String userName;
	private String userPassword;
	private Dict hobby;

	

	@Override
	public String getUserName() {
		return this.userName;
	}

	@Override
	public void setUserName(String userName) {
		this.userName=userName;
	}

	@Override
	public String getUserCode() {
		return this.userCode;
	}

	@Override
	public void setUserCode(String userCode) {
		this.userCode=userCode;
	}

	@Override
	public String getUserPassword() {
		return this.userPassword;
	}

	@Override
	public void setUserPassword(String userPassword) {
		this.userPassword=userPassword;
	}

	
	@AttributeOverrides({
		@AttributeOverride(name=Dict.CODE,column=@Column(name="hobby",length=50))
	})
	public Dict getHobby() {
		return hobby;
	}

	public void setHobby(Dict hobby) {
		this.hobby = hobby;
	}

	/* 
	 * 将Excel数据对象转换为用户对象
	 * (non-Javadoc)
	 * @see com.dc.commons.utils.excel.ExcelConvert#convert(com.dc.commons.utils.excel.Row)
	 */
	@Override
	public DcSysUser convert(RowData row) {
		DcSysUser user=new DcSysUser();
		user.setUserCode(row.getCells().get(0).getData().toString());
		user.setUserName(row.getCells().get(1).getData().toString());
		user.setHobby(Dict.valueOf(row.getCells().get(2).getData().toString()));
		return user;
	}


}
